<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.3" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon.ico?v=5.1.3">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon.ico?v=5.1.3">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon.ico?v=5.1.3">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.3" color="#222">





  <meta name="keywords" content="hexo,备份,插件," />










<meta name="description" content="前言hexo文件夹中重要的是source跟scaffolds，themes目录.gitignore，_config.yml文件，插件目录可以通过命令行重新下载，只要备份了这些便可以恢复原先的内容 插件下载项目地址. 如果hexo版本 2.x.x, 执行:1$ npm install hexo-git-backup@0.0.91 --save 如果版本 3.x.x, 执行: 1$ npm insta">
<meta name="keywords" content="hexo,备份,插件">
<meta property="og:type" content="article">
<meta property="og:title" content="利用 git-backup 插件备份hexo数据">
<meta property="og:url" content="http://hexo.mantoujun.top/2017/04/25/利用 git-backup 插件备份hexo数据/index.html">
<meta property="og:site_name" content="未知领域">
<meta property="og:description" content="前言hexo文件夹中重要的是source跟scaffolds，themes目录.gitignore，_config.yml文件，插件目录可以通过命令行重新下载，只要备份了这些便可以恢复原先的内容 插件下载项目地址. 如果hexo版本 2.x.x, 执行:1$ npm install hexo-git-backup@0.0.91 --save 如果版本 3.x.x, 执行: 1$ npm insta">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2017-04-30T10:10:36.732Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="利用 git-backup 插件备份hexo数据">
<meta name="twitter:description" content="前言hexo文件夹中重要的是source跟scaffolds，themes目录.gitignore，_config.yml文件，插件目录可以通过命令行重新下载，只要备份了这些便可以恢复原先的内容 插件下载项目地址. 如果hexo版本 2.x.x, 执行:1$ npm install hexo-git-backup@0.0.91 --save 如果版本 3.x.x, 执行: 1$ npm insta">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.3',
    sidebar: {"position":"left","display":"always","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://hexo.mantoujun.top/2017/04/25/利用 git-backup 插件备份hexo数据/"/>





  <title>利用 git-backup 插件备份hexo数据 | 未知领域</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">未知领域</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">女装是最吼的</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://hexo.mantoujun.top/2017/04/25/利用 git-backup 插件备份hexo数据/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="pancc">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="未知领域">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">利用 git-backup 插件备份hexo数据</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-04-25T13:14:36+08:00">
                2017-04-25
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/hexo/" itemprop="url" rel="index">
                    <span itemprop="name">hexo</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/hexo/插件/" itemprop="url" rel="index">
                    <span itemprop="name">插件</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h1><p>hexo文件夹中重要的是<code>source</code>跟<code>scaffolds</code>，<code>themes</code>目录<code>.gitignore</code>，<code>_config.yml</code>文件，插件目录可以通过命令行重新下载，只要备份了这些便可以恢复原先的内容</p>
<h1 id="插件下载"><a href="#插件下载" class="headerlink" title="插件下载"></a>插件下载</h1><p><a href="https://github.com/coneycode/hexo-git-backup.git" target="_blank" rel="noopener">项目地址.</a></p>
<h2 id="如果hexo版本-2-x-x-执行"><a href="#如果hexo版本-2-x-x-执行" class="headerlink" title="如果hexo版本 2.x.x, 执行:"></a>如果hexo版本 2.x.x, 执行:</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm <span class="keyword">install</span> hexo-git-<span class="keyword">backup</span>@<span class="number">0.0</span><span class="number">.91</span> <span class="comment">--save</span></span><br></pre></td></tr></table></figure>
<p>如果版本 3.x.x, 执行:</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm <span class="keyword">install</span> hexo-git-<span class="keyword">backup</span> <span class="comment">--save</span></span><br></pre></td></tr></table></figure>
<h1 id="升级插件"><a href="#升级插件" class="headerlink" title="升级插件"></a>升级插件</h1><p>如果你使用 –save安装了插件, 执行：</p>
<figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ npm remove hexo-git-<span class="keyword">backup</span></span><br><span class="line">$ npm <span class="keyword">install</span> hexo-git-<span class="keyword">backup</span> <span class="comment">--save</span></span><br></pre></td></tr></table></figure>
<h1 id="设置"><a href="#设置" class="headerlink" title="设置"></a>设置</h1><p>你应该在 <code>hexo/_config.yml.</code>文件中为插件添加设置</p>
<figure class="highlight less"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">backup</span>:</span><br><span class="line">    <span class="attribute">type</span>: git</span><br><span class="line">	<span class="attribute">message</span>: update xxx <span class="comment">//可选，diy信息</span></span><br><span class="line">	<span class="attribute">theme</span>: coney,landscape  <span class="comment">//可选，主题备份</span></span><br><span class="line">    <span class="attribute">repository</span>:</span><br><span class="line">       <span class="attribute">github</span>: git<span class="variable">@github</span>.<span class="attribute">com</span>:xxx/xxx.git,branchName <span class="comment">//备份的目的路径，必填branch分支</span></span><br><span class="line">       <span class="attribute">gitcafe</span>: git<span class="variable">@github</span>.<span class="attribute">com</span>:xxx/xxx.git,branchName <span class="comment">//可选，备份到gitcafe</span></span><br></pre></td></tr></table></figure>
<p>Now you can backup all the blog!</p>
<h1 id="用法"><a href="#用法" class="headerlink" title="用法"></a>用法</h1><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo <span class="keyword">backup</span></span><br></pre></td></tr></table></figure>
<p>或者</p>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">hexo</span> b</span><br></pre></td></tr></table></figure>
<h1 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h1><h2 id="你可能会遇到系统权限问题。"><a href="#你可能会遇到系统权限问题。" class="headerlink" title="你可能会遇到系统权限问题。"></a>你可能会遇到系统权限问题。</h2><h3 id="Error-EISDIR-open-it-is-caused-by-permission-just-do-‘sudo-hexo-b’"><a href="#Error-EISDIR-open-it-is-caused-by-permission-just-do-‘sudo-hexo-b’" class="headerlink" title="Error: EISDIR, open it is caused by permission. just do ‘sudo hexo b’"></a>Error: EISDIR, open it is caused by permission. just do ‘sudo hexo b’</h3><figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">sudo</span> hexo b</span><br></pre></td></tr></table></figure>
<h2 id="恢复"><a href="#恢复" class="headerlink" title="恢复"></a>恢复</h2><p>重装系统或者在其他电脑上修改博客时，执行以下不走</p>
<ol>
<li>安装 hexo 环境</li>
<li><code>git clone</code>执行克隆</li>
<li>将 backup（取决于备份时候的设定） 分支复制到 hexo 目录</li>
<li>执行<code>hexo -d</code>, 重新配置账户</li>
</ol>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/hexo/" rel="tag"># hexo</a>
          
            <a href="/tags/备份/" rel="tag"># 备份</a>
          
            <a href="/tags/插件/" rel="tag"># 插件</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/04/24/《Deep-Learning》（深度学习）中文版开放下载/" rel="next" title="《Deep-Learning》（深度学习）中文版开放下载">
                <i class="fa fa-chevron-left"></i> 《Deep-Learning》（深度学习）中文版开放下载
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/04/26/Shadowsocks服务器端的搭建/" rel="prev" title="Shadowsocks服务器端的搭建(请善用返回功能)">
                Shadowsocks服务器端的搭建(请善用返回功能) <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/uploads/avatar.jpg"
                alt="pancc" />
            
              <p class="site-author-name" itemprop="name">pancc</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">28</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">28</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">26</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          <div class="links-of-author motion-element">
            
          </div>

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#前言"><span class="nav-number">1.</span> <span class="nav-text">前言</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#插件下载"><span class="nav-number">2.</span> <span class="nav-text">插件下载</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#如果hexo版本-2-x-x-执行"><span class="nav-number">2.1.</span> <span class="nav-text">如果hexo版本 2.x.x, 执行:</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#升级插件"><span class="nav-number">3.</span> <span class="nav-text">升级插件</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#设置"><span class="nav-number">4.</span> <span class="nav-text">设置</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#用法"><span class="nav-number">5.</span> <span class="nav-text">用法</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#问题"><span class="nav-number">6.</span> <span class="nav-text">问题</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#你可能会遇到系统权限问题。"><span class="nav-number">6.1.</span> <span class="nav-text">你可能会遇到系统权限问题。</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Error-EISDIR-open-it-is-caused-by-permission-just-do-‘sudo-hexo-b’"><span class="nav-number">6.1.1.</span> <span class="nav-text">Error: EISDIR, open it is caused by permission. just do ‘sudo hexo b’</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#恢复"><span class="nav-number">6.2.</span> <span class="nav-text">恢复</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2015 &mdash; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">pancc</span>

  
</div>









        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  




  
  









  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three-waves.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.3"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.3"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.3"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.3"></script>



  


  




	





  





  









<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//unpkg.com/valine/dist/Valine.min.js"></script>



  





  

  

  

  
  

  

  

  

</body>
</html>
